<?php
	//数据库连接
	require_once 'init.php';
	require_once 'ckLogin.php';
	require_once 'dbClasses'.DIRECTORY_SEPARATOR.'config.php';
	require_once 'dbClasses'.DIRECTORY_SEPARATOR.'dbConn.php';
	$db = new dbConn();
	//定义表名
	define("TABLENAME","fanhuan_content");
	define("TABLENAME1","admin");
	define("TABLENAME2","fanhuan_category");
	//
	require_once 'insertNewFunction.php';
	//前提   --- 时间
	$time = $_GET['time'];
	//$time = substr($time,0,4).'-'.substr($time,4,2).'-'.substr($time,6,2);
	//提交处理
	if(strtoupper($_SERVER['REQUEST_METHOD'])=='POST'){
		//  updater originalPrice currentPrice title desc pic goodsUrl
		$title = $_POST['title'];
		$pics = $_POST['pic'];
		$updater = $_POST['updater'];
		$originalPrice = $_POST['originalPrice'];
		$currentPrice = $_POST['currentPrice'];
		$goodsUrl = $_POST['goodsUrl'];
		$desc = $_POST['desc'];
		$cateid = $_POST['cateid'];
		$saledNum = $_POST['saledNum'];
		$commission = $_POST['commission'];
		//手动录入用1，根据id接口用2，默认2
		$comefrom = 1;
		foreach ($pics as $key=>$item){
			$db->sql="insert into ".TABLENAME."(publishDate,picture,title,goodsUrl,`desc`,originalPrice,currentPrice,updater,comefrom,`status`,cateID,saledNum,commission) ".
				     "values ('".$time."','".$item."','".$title[$key]."','".str_replace(' ', '', trim($goodsUrl[$key]) )."','".$desc[$key]."','".$originalPrice[$key]."','".$currentPrice[$key]."','".$updater[$key]."',".$comefrom.",0,".$cateid[$key].",".$saledNum[$key].",".$commission[$key].")";
			$db->doExecute();
		}
			
	}
	
	/* ------------begin 文件处理---------------  */	
	//读取文件夹
	$files = read_dir('../'.PARENTDIR);
	//读取数据库
	$db->sql = "select * from ".TABLENAME." where publishDate >= '".date("Y-m-d")."'";
	$files_find = $db->doResultList2();
	foreach ($files_find as $item){
		//=====需更改位置======//
		if(PARENTDIR=="content/"){
			$dateKey = explode('-', $item['publishDate']);
			$dateKey = $dateKey[0].$dateKey[1].$dateKey[2];
		}else{$dateKey=$item['publishDate'];}
		$files_find2[$dateKey][] = $item['picture'];
	}
	$result = getNew($files[0], $files_find2);
	$picNew = $result[0];
	$gtDay  = $result[1];
	if(!empty($picNew)){
		$picNew2 = getName($picNew,$files[1]);
		$picNew2 = getNewContent($picNew2,$files[2]);
	}/*------------ end 文件处理  ----------------*/
	/* ------------begin 未审核列表---------------  */
	
	//条件
	$where = "WHERE p.`status`=0 AND p.`isDel`!=1 ";
	if(!empty($_GET['startTime']) || !empty($_GET['endTime']) || !empty($_GET['updater']) || !empty($_GET['cateid']) || !empty($_GET['goodsid'])){
		if(!empty($_GET['startTime'])) $where.= "AND p.publishDate>='".$_GET['startTime']."' ";
		if(!empty($_GET['endTime'])) $where.= "AND p.publishDate<='".$_GET['endTime']."' ";
		if(!empty($_GET['updater'])) $where.= "AND p.updater='".$_GET['updater']."' ";
		if(!empty($_GET['cateid'])) $where.= "AND c.id='".$_GET['cateid']."' ";
		if(!empty($_GET['goodsid'])) $where.= "AND p.goodsID='".$_GET['goodsid']."' ";
	
	}
	//排序publishDate Updater shared collected
	if(!empty($_GET['sort'])){
		$sortarray = explode('_', $_GET['sort']);
		$order = "p.".$sortarray[0]." ".$sortarray[1].",";
	}else{
		$order = '';
	}
	//总条数
	$db->sql="SELECT count(p.id) count_id FROM ".TABLENAME." p LEFT JOIN ".TABLENAME2." c ON c.id = p.cateID ".$where;
	$count = $db->doResultOne();
	//分页
	if(empty($_GET['page'])){$page = 1;}else{$page=$_GET['page'];}
	if(empty($_GET['pagesize'])){$pagesize = PAGESIZE;}
	else{$pagesize = $_GET['pagesize'];}
	$pageInfo = page($count, $pagesize, $page);
	$maxPage = $pageInfo['maxPage'];
	$start = $pageInfo['start'];
	$pages = $pageInfo['pages'];
	
	$db->sql="SELECT p.*,a.nickName,a.id aid,c.cate FROM ".TABLENAME." p LEFT JOIN ".TABLENAME1." a ON p.updater = a.userName LEFT JOIN ".TABLENAME2." c ON c.id = p.cateID ".$where." ORDER BY ".$order." p.publishDate DESC LIMIT ".$start.",".$pagesize;
	$pictures = $db->doResultList2();
	
	//url
	//$url= "?startTime=".$_GET['startTime']."&endTime=".$_GET['endTime']."&updater=".$_GET['updater']."&pagesize=".$_GET['pagesize']."&sort=".$_GET['sort'];
	//$url2="?startTime=".$_GET['startTime']."&endTime=".$_GET['endTime']."&updater=".$_GET['updater']."&pagesize=".$_GET['pagesize'];
	//url
	$url= "?startTime=".$_GET['startTime']."&endTime=".$_GET['endTime']."&updater=".$_GET['updater']."&pagesize=".$_GET['pagesize']."&goodsid=".$_GET['goodsid']."&cateid=".$_GET['cateid']."&sort=".$_GET['sort'];
	$url2="?startTime=".$_GET['startTime']."&endTime=".$_GET['endTime']."&updater=".$_GET['updater']."&pagesize=".$_GET['pagesize']."&goodsid=".$_GET['goodsid']."&cateid=".$_GET['cateid'];
	$url3="?startTime=".$_GET['startTime']."&endTime=".$_GET['endTime']."&updater=".$_GET['updater']."&pagesize=".$_GET['pagesize']."&goodsid=".$_GET['goodsid'];
	
	/* ------------end 未审核列表---------------  */
	//分类
	$db->sql="SELECT * FROM `".TABLENAME2."` ORDER BY `sort`";
	$category = $db->doResultList2();
	
	//用户列表
	$admins = getAdmin($db);
	//var_dump($admins);
	function getAdmin($db){
		$db->sql = "SELECT * FROM ".TABLENAME1." WHERE id != 1 AND type=2";
		return $admins = $db->doResultList2();
	}
	//分页
	function page($total,$size,$page){
		//最大页数
		if($total%$size==0){
			$maxPage = $total/$size;
		}else{
			$maxPage = (int)($total/$size)+1;
		}
		//开始条数
		$start = ($page-1)*$size;
		//分页
		if($maxPage>=5){
			if($page<=2){
				$pages=array(1,2,3,4,5);
			}elseif($page>=($maxPage-1)){
				$pages=array($maxPage-4,$maxPage-3,$maxPage-2,$maxPage-1,$maxPage);
			}else{
				$pages=array($page-2,$page-1,$page,$page+1,$page+2);
			}
		}else{
			for($i=1;$i<=$maxPage;$i++){
				$pages[]=$i;
			}
		}
		if($page<=1){$previous=1;}else{$previous=$page-1;}
		if($page>=$maxPage) {$next = $maxPage;}else{ $next = $page+1;}
		return array('maxPage'=>$maxPage,'start'=>$start,'pages'=>$pages,'previous'=>$previous,'next'=>$next);
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Simpla Admin</title>
<!--                       CSS                       -->
<!-- Reset Stylesheet -->
<link rel="stylesheet" href="resources/css/reset.css" type="text/css"
	media="screen" />
<!-- Main Stylesheet -->
<link rel="stylesheet" href="resources/css/main.css" type="text/css"
	media="screen" />
<!-- Invalid Stylesheet. This makes stuff look pretty. Remove it if you want the CSS completely valid -->
<link rel="stylesheet" href="resources/css/invalid.css" type="text/css"
	media="screen" />
<!-- Colour Schemes
		Default colour scheme is green. Uncomment prefered stylesheet to use it.
		<link rel="stylesheet" href="resources/css/blue.css" type="text/css" media="screen" />
		<link rel="stylesheet" href="resources/css/red.css" type="text/css" media="screen" />  
		-->
<!-- Internet Explorer Fixes Stylesheet -->
<!--[if lte IE 7]>
			<link rel="stylesheet" href="resources/css/ie.css" type="text/css" media="screen" />
		<![endif]-->
<!--                       Javascripts                       -->
<!-- jQuery -->
<script type="text/javascript" src="resources/scripts/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
$(function($) {
	$(".editbutton").click(function(){
		$("#publicDate").val( $(this).children("input:eq(0)").val() );
		$("#imgAddress").val( $(this).children("input:eq(1)").val() );
		//$("#description").html('221');
	});
	//多数据操作
	$(".button").click(function(){
		var picdesc = $(this).parent().siblings("p").children(".text-input");
		var author= $(this).parent().siblings("p").find("select");
		var nopic=0;
		var noauthor=0;
		$(picdesc).each(function() {
			if( $(this).val()==''){nopic++;}  
        	});
		$(author).each(function() {
			if( $(this).val()==''){noauthor++;} 
       		 });
		if ( nopic!=0 || noauthor!=0 ) {
			alert("应填写内容共有:"+(picdesc.length+author.length)+"项 。其中有 "+nopic+" 项图片描述没有填写。"+noauthor+" 项责任编辑没有选择");
			return false;
		}
		//if(nullNum != 0){alert("还有"+nullNum+"个描述没有填写！");return false;}	
	});

	$("#taobao_url_subm").click(function(){
		var taobao_item_id = $("#taobao_item_id").val();
		var taobao_url = $("#taobao_url").val();
		//alert(taobao_item_id+' || '+taobao_url);
		var img_span ='';
		//获取描述
		$.ajax({
			type: "GET",
			url: "taobaoItemInfo.php",
			data: "id="+taobao_item_id+"&url="+taobao_url,
			dataType: "json",
			success: function(date){
				$("#goodsUrl").val(taobao_url);
				$("#originalPrice").val(date.price);
				$("#title").val(date.title);
				$.each(date.item_imgs.item_img, function(i,item){
					img_span += '<input type="radio" name="taobao_item_img" value="'+item.url+'"/>'+
						'<img src="'+item.url+'" alt="" style="width: 50px;height: 50px;"/>';
				});
				$("#taobao_img_span").html(img_span);
				//$("#title").val();
				$("#message_click").click();
			}
		});
	});

	$("#loading_img").ajaxStart(function(){
		$(this).show();
	});
	$("#loading_img").ajaxSuccess(function(evt, request, settings){
		$(this).hide();
	});
	$("#loading_img").ajaxError(function(event,request, settings){
	     $(this).append("出错页面:" + settings.url + "");
	});

	//审核通过
	$(".shenheButton").click(function(){
		var id = $(this).attr("id");
		if(confirm("是否审核通过")){
			//获取描述
			$.ajax({
				type: "GET",
				url: "youpinAjax.php",
				data: "id="+id+"&act=shenhe&table=fanhuan_content",
				dataType: "html",
				success: function(date){
					//alert(date);
					
				}
			});
			$(this).parents("tr").remove();
			
		}
	});
	//修改
	$(".editButton").click(function(){
		var tds = $(this).parent('td').siblings();
		//alert(tds.eq(11).children('span').text());
		$("#updater_2 option").attr("selected",false);
		$("#update-option-"+tds.eq(11).children('span').text()).attr("selected","selected");
		$("#cate_id option").attr("selected",false);
		$("#cate-option-"+tds.eq(10).children('span').text()).attr("selected","selected");
		$("#goodsUrl").val(tds.eq(6).children("a").attr("href"));
		$("#originalPrice").val(tds.eq(7).text());
		$("#currentPrice").val(tds.eq(8).text());
		$("#title").val(tds.eq(4).text());
		$("#description").text(tds.eq(5).text());
		$("#publishDate").val(tds.eq(3).text());
		$("#sort").val(tds.eq(14).text());
		$("#contentID").val(tds.eq(1).text());
		$("#saledNum").val(tds.eq(15).text());
		$("#commission").val(tds.eq(9).children("span").text());

		$("#pic_1").val(tds.eq(2).find("img").attr("src"));
		//$("#title").val();
		$("#message_click").click();
	});
	//删除商品
	$(".deleteButton").click(function(){
		var id = $(this).data("id");
		//alert(id);return false;
		if(confirm("是否删除该商品！")){
			//获取描述
			$.ajax({
				type: "GET",
				url: "youpinAjax.php",
				data: "id="+id+"&act=del&table=fanhuan_content",
				dataType: "html",
				success: function(date){
					//$(".content-box-content").append(date);
					
				}
			});
			$(this).parents("tr").hide();
			
		}
	});
	$("#taobao_item_subm").click(function(){
		alert(123);
		return false;
	});
	$(".tongguo").click(function(){
		//alert("121");
		var ids = '';
		$("input[type='checkbox']:checked").each(function(){
			//alert($(this).val());
			ids += $(this).val()+','
			$(this).parents("tr").hide()
			$(this).attr("checked",false);
		});
		//alert(ids);
		//批量通过
		$.ajax({
			type: "GET",
			url: "youpinAjax.php",
			data: "ids="+ids+"&act=piliangtongguo&table=fanhuan_content",
			dataType: "html",
			success: function(date){
				if(date!=-1 && date){
					alert("审核通过！");
				}else{
					alert("刷新重新操作！");
				}
			}
		});
		
	});

	//批量删除
	$(".piliangshanchu").click(function(){
		if(confirm("是否删除这些商品！")){
			var ids='';
			$("input[name=picSel]:checked").each(function() {
				ids+=$(this).val()+',';
				$(this).parents("tr").remove();
			});
			$.ajax({
				type: "GET",
				url: "youpinAjax.php",
				data: "ids="+ids+"&act=piliangshanchu&table=fanhuan_content",
				dataType: "html",
				success: function(date){
					//alert(date);
					
				}
			});
			//alert(ids);
		}
	});
});
</script>
<!-- jQuery Configuration -->
<script type="text/javascript" src="resources/scripts/simpla.jquery.configuration.js"></script>
<!-- Facebox jQuery Plugin -->
<script type="text/javascript" src="resources/scripts/facebox.js"></script>
<!-- jQuery WYSIWYG Plugin -->
<script type="text/javascript" src="resources/scripts/jquery.wysiwyg.js"></script>
<!-- jQuery my97datepicker -->
<script type="text/javascript" src="resources/scripts/My97DatePicker/WdatePicker.js"></script>
<!--[if IE]><script type="text/javascript" src="resources/scripts/jquery.bgiframe.js"></script><![endif]-->
<!-- Internet Explorer .png-fix -->
<!--[if IE 6]>
			<script type="text/javascript" src="resources/scripts/DD_belatedPNG_0.0.7a.js"></script>
			<script type="text/javascript">
				DD_belatedPNG.fix('.png_bg, img, li');
			</script>
		<![endif]-->

</head>
<body>
	<div id="body-wrapper">
	<?php if ($_GET['publishDateError']==1):?>
		<div class="notification error png_bg">
			<a href="#" class="close"><img src="resources/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
			<div>
				修改失败，只能把时间改到今天或者之后，不能改到之前！
			</div>
		</div>
	<?php endif;?>
		<!-- Wrapper for the radial gradient background -->
		<a href="#messages" rel="modal" id="message_click"></a>
		<div id="messages" style="display: none;">
			<!-- Messages are shown when a link with these attributes are clicked: href="#messages" rel="modal"  -->

			<p style="">
				<strong>简短描述输入及修改</strong>
			</p>
			<form action="fanhuan_picList.php" method="post" >
				<fieldset>
					责任编辑：
					<select id="updater_2" name="updater_2" style="width: 300px;">
						<option value="" ></option>
						<?php foreach ($admins as $keyX=>$itemX):?>
						<option id="update-option-<?php echo $itemX['id'];?>" value="<?php echo $itemX['userName'];?>" <?php if($_SESSION['userName']==$itemX['userName']):?>selected="selected"<?php endif;?> ><?php echo $itemX['nickName'];?></option>
						<?php endforeach;?>
					</select><br />
					地址：
					<input class="text-input " type="text" id="goodsUrl" name="goodsUrl" style="width: 310px;"/><br />
					名称：
					<input class="text-input " type="text" id="title" name="title" style="width: 310px;"/><br />
					图片：
					<input class="text-input " type="text" id="pic_1" name="pic_1" style="width: 310px;"/><br />
					原价：
					<input class="text-input " type="text" id="originalPrice" name="originalPrice" style="width: 60px;"/>
					现价：
					<input class="text-input " type="text" id="currentPrice" name="currentPrice" style="width: 60px;"/>
					佣金：
					<input class="text-input " type="text" id="commission" name="commission" style="width: 60px;"/>%<br />
					分类：
					<select id="cate_id" name="cate_id" style="width: 325px;">
						<option value="" ></option>
						<?php foreach ($category as $keyY=>$itemY):?>
						<option id="cate-option-<?php echo $itemY['id'];?>" value="<?php echo $itemY['id'];?>" ><?php echo $itemY['cate'];?></option>
						<?php endforeach;?>
					</select><br />
					描述：
					<textarea class="textarea" id="description" name="description" cols="79" rows="5"></textarea>
					发布日期：
					<input class="text-input " type="text" id="publishDate" name="publishDate" onClick="WdatePicker()"/><br />
					商品排序：
					<input class="text-input " type="text" id="sort" name="sort" value="1"/><br />
					已售数量：
					<input class="text-input " type="text" id="saledNum" name="saledNum" value=""/><br />
					<span id="taobao_img_span">
					</span>
					
					<input id="comefrom" name="comefrom" type="hidden" value="2" />
					<input id="contentID" name="contentID" type="hidden" value="" />
					<div style="clear: both;height: 1px;background-color: #D5D5D5;margin: 10px 0;"></div>
					
					<input class="button" type="submit" value="修改" id="taobao_item_subm"/>
					<a href="javascript:void(0);" class="close" onclick="$(this).parents('#facebox').hide();"> <img src="resources/images/closelabel.jpg" title="close" class="close_image" /> </a>
				</fieldset>
			</form>
		</div>
		<!-- End #messages -->
		
		<div id="main-content">
			<!-- Page Head
			<h2>欢迎使用<span style="color:red;">返还网商品</span>管理后台</h2>
			<p id="page-intro">接下来你要做什么呢亲？</p>
			<div class="clear"></div> -->
			<!-- End .clear -->
			
			<!-- 淘宝url添加 -->
			<span id="loading_img" style="display: none;"><img src="resources/images/loading.gif"/></span>
			<!-- <span style="color: gray;">方法一</span> ： 淘宝推广添加：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;产品id：<input type="text" id="taobao_item_id" name="taobao_item_id" style=""/>
			推广url：<input type="text" id="taobao_url" name="taobao_url" style="width: 300px;"/>
			<button id="taobao_url_subm">提交</button><span style="color: red;">（不可用中...）</span>
			<br /> -->
			方法1 ： <a href="dataimport.php">数据导入</a> <span style="color: gray;">请将*.xls文件上传到 content/dataimport/ 目录下，不要建日期目录。</span>
			<br /><hr />
			方法2： 上传图片，手动输入，如下。
			<br /><hr />
			<?php if(count($picNew2)>0):?>
			<?php foreach ($picNew2 as $key=>$item):?>
			<div class="content-box">
				<!-- Start Content Box -->
				<div class="content-box-header">
					<h3><?php echo $key;?></h3>
					<!-- <ul class="content-box-tabs">
						<li><a href="#tab1" class="default-tab">Table</a></li>
						href must be unique and match the id of target div
						<li><a href="#tab2">Forms</a></li>
					</ul> -->
					<div class="clear"></div>
				</div>
				<!-- End .content-box-header -->
				<div class="content-box-content">
					<div class="tab-content default-tab" id="tab1">
						<!-- This is the target div. id must match the href of this div's tab -->
						<form action="?time=<?php echo $key;?>" method="post">
							<fieldset>
								<!-- Set class to "column-left" or "column-right" on fieldsets to divide the form into columns -->
								<?php
									foreach ($item as $key2=>$item2):
								?>
								<p>
									<a href="<?php echo '../'.$item2['url'];?>" title="" target="_blank">
										<img src="<?php echo '../'.$item2['url'];?>" alt="" width="50px;" height="50px;"/>
									</a>  
									<span style="margin-left: 50px;">责任编辑:
										<select name="updater[]" style="width: 70px;">
											<option value="" ></option>
											<?php foreach ($admins as $item3):?>
											<option value="<?php echo $item3['userName'];?>" <?php if ($_SESSION['userName']==$item3['userName']):?>selected="selected"<?php endif;?>><?php echo $item3['nickName'];?></option>
											<?php endforeach;?>
										</select>
										原价：￥<input class="text-input" type="text" name="originalPrice[]" style="width: 50px;"/>
										现价：￥<input class="text-input" type="text" name="currentPrice[]" style="width: 50px;"/>
										佣金：<input class="text-input" type="text" name="commission[]" style="width: 50px;"/>%
										分类：<select name="cateid[]" style="width: 80px;">
											<option value="" ></option>
											<?php foreach ($category as $keyY=>$itemY):?>
											<option id="cate-option-<?php echo $itemY['id'];?>" value="<?php echo $itemY['id'];?>" ><?php echo $itemY['cate'];?></option>
											<?php endforeach;?>
										</select>
										已售：<input class="text-input" type="text" name="saledNum[]" style="width: 50px;"/>
										地址：<input class="text-input" type="text" name="goodsUrl[]" style="width: 230px;"/>
									</span>
									<br />
									<small>请填写标题！！</small>
									<input class="text-input large-input" type="text" name="title[]" value="<?php echo $item2['content'];?>"/>
									<small>请填写描述！！</small>
									<textarea class="text-input textarea" name="desc[]" ></textarea>
									<input type="hidden" id="" name="pic[]" value="<?php echo $item2['url'];?>"/>
									<!-- updater originalPrice currentPrice title desc pic goodsUrl -->
								</p>
								<?php endforeach; ?>
								<p><input class="button" type="submit" value="添加" id="Add<?php echo $key;?>"/></p>
							</fieldset>
							<div class="clear"></div>
							<!-- End .clear -->
						</form>
					</div>
					<!-- End #tab1 -->
				</div>
				<!-- End .content-box-content -->
			</div>
			<?php endforeach;else:?>
			<div class="content-box"><div class="content-box-content" style="font-size: x-large;font-weight: bold;">没有新图</div></div>
			<?php endif;?>
			<!-- End .content-box -->
			
			
			<div class="content-box">
				<!-- Start Content Box 
				<div class="content-box-header">
					<h3><?php echo WHAT;?>审核列表</h3>
					
					<div class="clear"></div>
				</div>-->
				<!-- End .content-box-header -->
				
				<div class="content-box-content">
				  <div style="background-color: #E4E4E4;padding: 5px 10px;">
					分类：<?php foreach ($category as $item):?>&nbsp;&nbsp;&nbsp;
						<?php if ($item['id']==$_GET['cateid']) : echo $item['cate'];else:?>
						<a href="<?php echo $url3;?>&cateid=<?php echo $item['id'];?>"><?php echo $item['cate'];?></a>
						<?php endif;endforeach;?>
					<form method="get" action="">
						商品ID：<input type="text" id="goodsid" name="goodsid" value="<?php echo $_GET['goodsid'];?>" size="12"/> 
						时间：
						<input type="text" id="startTime" name="startTime" onClick="WdatePicker()" value="<?php echo $_GET['startTime'];?>" size="10"/> 
						-
						<input type="text" id="endTime" name="endTime" onClick="WdatePicker()" value="<?php echo $_GET['endTime'];?>" size="10"/>
						&nbsp;&nbsp;&nbsp;责任编辑：
						<select id="updater" name="updater" style="">
							<option value="" ></option>
							<?php foreach ($admins as $keyX=>$itemX):?>
							<option id="" value="<?php echo $itemX['userName'];?>" <?php if($_GET['updater']==$itemX['userName']) echo 'selected="selected"';?>><?php echo $itemX['nickName'];?></option>
							<?php endforeach;?>
						</select>
						&nbsp;&nbsp;&nbsp;
						每页<input id="pagesize" name="pagesize" type="text" size="2" value="<?php echo $pagesize;?>"/>条
						&nbsp;&nbsp;&nbsp;
						<button class="button" id="zhixing" type="submit">搜索</button>
						<input type="hidden" id="cateid" name="cateid" value="<?php echo $_GET['cateid'];?>"/>
						
					</form>
				  </div>
					<div class="tab-content default-tab" id="tab1">
						<!-- This is the target div. id must match the href of this div's tab -->

						<table>
							<thead>
								<tr>
									<td colspan="17">
										<div class="bulk-actions align-left">
											<button class="button tongguo" >批量通过</button>
											<button class="button piliangshanchu" >批量删除</button>
										</div>
										<?php if($maxPage>0):?>
										<div class="pagination">
											<a href="<?php //echo $url;?>?page=1" title="First Page">&laquo; First</a>
											<a href="<?php //echo $url."&page=".$pageInfo['previous'];?>" title="Previous Page">&laquo; Previous</a>
											<?php foreach ($pages as $item):?> 
											<a href="<?php echo $url."&page=".$item;?>" class="number <?php if($item == $page) echo 'current';?>" title="<?php echo $item;?>"><?php echo $item;?></a>
											<?php endforeach;?>
											<a href="<?php echo $url."&page=".$pageInfo['next'];?>" title="Next Page">Next &raquo;</a>
											<a href="<?php echo $url."&page=".$maxPage;?>" title="Last Page">Last &raquo;</a>
											total : <?php echo $maxPage;?>
										</div> 
										<?php endif;?>
										<!-- End .pagination -->
										<div class="clear"></div>
									</td>
								</tr>
							</thead>
							<thead>
								<tr>
									<th><input class="check-all" type="checkbox" value="-1"/></th>
									<th>编号</th>
									<th>图片</th>
									<th>日期</th>
									<th style="width: 6%;">标题</th>
									<th style="width: 10%;">描述</th>
									<th style="width: 10%;" class="taobao_url_css">地址</th>
									<th style="width: 6%;">原价</th>
									<th style="width: 6%;">现价</th>
									<th style="width: 6%;">佣金</th>
									<th style="">分类</th>
									<th>责任编辑</th>
									<th style="display: none;">分享</th>
									<th style="display: none;">收藏</th>
									<th>排序</th>
									<th>已售</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody>
							<?php if(count($pictures)>0):?>
							<?php foreach ($pictures as $key=>$item):?>
								<tr>
									<td><input type="checkbox" name="picSel" value="<?php echo $item['id'];?>"/></td>
									<td><?php echo $item['id'];?></td>
									<td><a href="<?php if($item['comefrom']==2) echo $item['picture'];else echo '../'.$item['picture'];?>" title="<?php echo $item['title'];?>" target="_blank"><img src="<?php if($item['comefrom']==2) echo $item['picture'];else echo '../'.$item['picture'];?>" alt="" width="50px;" height="50px;"/></a></td>
									<td><?php echo $item['publishDate'];?></td>
									<td><?php echo $item['title'];?></td>
									<td><?php echo $item['desc'];?></td>
									<td><a href="<?php echo $item['goodsUrl'];?>"><?php echo $item['goodsID'];?></a></td>
									<td><?php echo $item['originalPrice'];?></td>
									<td><?php echo $item['currentPrice'];?></td>
									<td><?php if(!empty($item['commission'])) echo '<span>'.$item['commission'].'</span>%';?></td>
									<td><?php echo $item['cate'];?><span style="display: none;"><?php echo $item['cateID'];?></span></td>
									<td><?php echo isset($item['nickName'])?$item['nickName']:$item['updater'];?><span style="display: none;"><?php echo $item['aid'];?></span></td>
									<td style="display: none;"><?php echo $item['shared'];?></td>
									<td style="display: none;"><?php echo $item['collected'];?></td>
									<td><?php echo $item['sort'];?></td>
									<td><?php echo $item['saledNum'];?></td>
									<td>
										<!-- Icons --> 
										<?php //if($_SESSION['userName']=='admin'):?>
										<a href="javascript:void(0);" title="shenhe" class="shenheButton" id="<?php echo $item['id'];?>">通过</a><br />
										<?php //endif;?>
										<a href="javascript:void(0);" title="Edit" class="editButton" id="<?php echo $item['id'];?>">修改</a> <br />
										<a href="javascript:void(0);" title="Delete" class="deleteButton" data-id="<?php echo $item['id'];?>">删除</a> <br />
										<!-- <a href="#" title="Edit Meta"><img src="resources/images/icons/hammer_screwdriver.png" alt="Edit Meta" /></a> -->
									</td>
									
								</tr>
							<?php endforeach;?>
							<?php else:?>
								<tr style="font-size: 30px; font-weight: bold;"><td colspan="9" >没有未通过审核<?php echo WHAT;?></td></tr>
							<?php endif;?>
							</tbody>
							<tfoot>
								<tr>
									<td colspan="17">
										<div class="bulk-actions align-left">
											<button class="button tongguo" >批量通过</button>
											<button class="button piliangshanchu" >批量删除</button>
										</div>
										<?php if($maxPage>0):?>
										<div class="pagination">
											<a href="<?php echo $url;?>&page=1" title="First Page">&laquo; First</a>
											<a href="<?php echo $url."&page=".$pageInfo['previous'];?>" title="Previous Page">&laquo; Previous</a>
											<?php foreach ($pages as $item):?> 
											<a href="<?php echo $url."&page=".$item;?>" class="number <?php if($item == $page) echo 'current';?>" title="<?php echo $item;?>"><?php echo $item;?></a>
											<?php endforeach;?>
											<a href="<?php echo $url."&page=".$pageInfo['next'];?>" title="Next Page">Next &raquo;</a>
											<a href="<?php echo $url."&page=".$maxPage;?>" title="Last Page">Last &raquo;</a>
											total : <?php echo $maxPage;?>
										</div> 
										<?php endif;?>
										<!-- End .pagination -->
										<div class="clear"></div>
									</td>
								</tr>
							</tfoot>
						</table>
					</div>
					<!-- End #tab1 -->
				</div>
				<!-- End .content-box-content -->
			</div>
			<!-- End .content-box -->
			<div class="clear"></div>
			<div id="footer">
				<small> <!-- Remove this notice or replace it with whatever you want -->
					&#169; Copyright 2009 Your Company | Powered by <a
					href="http://themeforest.net/item/simpla-admin-flexible-user-friendly-admin-skin/46073">Simpla
						Admin</a> | <a href="#">Top</a>
				</small>
			</div>
			<!-- End #footer -->
		</div>
		<!-- End #main-content -->
	</div>
</body>
<!-- Download From www.exet.tk-->
</html>
